<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <div class="tag" @click="changeArr">
            点击改变数据
        </div>
        <ul>
            <li v-for="item in arr">{{item.name}}</li>
        </ul>
        <child></child>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        const child = {
            data() {
                return {
                    name: '张三'
                }
            },
            template: `
                <div>这是个子组件</div>
            `,
            beforeCreate() {
                // console.log(document.querySelector('.tag'));
            },
        }

        new Vue({
            el: "#app",
            components: {
                child
            },
            data: {
                str: "hello world",
                arr: [{
                    name: '1243',
                    age: 13
                }]
            }, 
            // 创建之前
            beforeCreate() {
                
                
            },

            created() {
                
            },

            beforeMount() {
                
            },

            mounted() {
                
            },
            methods: {
                changeArr() {
                    this.arr[0].name = "李四"
                }
            },

            beforeUpdate() {
                
            },

            updated() {
                console.log(1);
            },

            beforeDestroy() {
                
            },

            destroyed() {
                
            },
        })
    </script>
</body>
</html>